package org.xbzheng.sc.controller.rest;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.xbzheng.sc.model.User;

/**
 * Created by Administrator on 2016/7/13.
 */
@Controller
public class LoginController {
    @RequestMapping(value = "/login", method=RequestMethod.GET)
    public String login(@RequestParam(required = false) final boolean error, final ModelMap model){
//        System.out.println(user.getPwd());
//        System.out.println(user.getUname());
        if(error){
            model.put("error", "You have entered an invalid username or password!");
        }else{
            model.put("error", "");
        }
        return ".login";
    }

    @RequestMapping(value="/login", method = RequestMethod.POST)
    public String login(User user){
        System.out.println(user.getUsername());
        return "";
    }
}
